<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	int i = 0;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'success.jsp' starting page</title>

<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link rel="stylesheet" type="text/css"
	href="lib/bootstrap/css/bootstrap.css">

<link rel="stylesheet" type="text/css" href="stylesheets/theme.css">
<link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css">



<!-- Demo page code -->

<style type="text/css">
#line-chart {
	height: 300px;
	width: 800px;
	margin: 0px auto;
	margin-top: 1em;
}

.brand {
	font-family: georgia, serif;
}

.brand .first {
	color: #ccc;
	font-style: italic;
}

.daojishi h2 {
	font-family: Helvetica, Microsoft YaHei, Arial, sans-serif;
	font-size: 14px;
	margin-bottom: 5px;
	color: #151515;
}

.daojishi #timer {
	font-family: Helvetica, Microsoft YaHei, Arial, sans-serif;
	font-size: 14px;
	color: #151515;
	font-weight: bold;
}

.brand .second {
	color: #fff;
	font-weight: bold;
}
</style>

<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="../assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed"
	href="../assets/ico/apple-touch-icon-57-precomposed.png">
<script src="<%=path%>/js/jquery-1.8.3.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
	$(function() {
		$("#getPaper").click(function() {
			var values = [];
			var arr2 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
			$('.inpputClass:checked').each(function(i, e) {
				var id = $(e).attr("name");
				var tihao = $("span[id=" + id + "]").html();
				values.push(tihao);
			});
			if (values.length < 10) {
				if(window.confirm("尚有题未答！请答完后交卷")){
				return true;
				}
				else{
				return false;
				}
				
			}
			
		});
	});
	
	var now1 = new Date();
	var end = now1.getTime() + (1 * 60 * 60 * 1000);
	var flag=false;
	function countTime() {
		//获取当前时间  
		if(!flag){
		var date = new Date();
		var now = date.getTime();

		//设置截止时间  
		//时间差  
		var leftTime = end - now;
		//定义变量 d,h,m,s保存倒计时的时间  
		var d, h, m, s;
		
		if (leftTime > 0) {
			//h = Math.floor(leftTime / 1000 / 60 / 60 / 60);
			m = Math.floor(leftTime / 1000 / 60 / 60);
			s = Math.floor(leftTime / 1000 % 60);
		}
		//将倒计时赋值到div中  
		/* document.getElementById("_h").innerHTML = h + "时"; */
		document.getElementById("_m").innerHTML = m + "分";
		document.getElementById("_s").innerHTML = s + "秒";
		//递归每秒调用countTime方法，显示动态时间效果  
		setTimeout(countTime, 1000);	
	    if ((Math.floor(leftTime / 1000 % 60) == 0) &&(Math.floor(leftTime / 1000 / 60 / 60)==0)) {
		   	alert("时间到！系统自动交卷");
			  flag=true;
			}
		}
		else
		{
				document.forms["theform1"].submit();
		
		}
	}
	
	function doCheck(){
	        var values = [];
			var arr2 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
			$('.inpputClass:checked').each(function(i, e) {
				var id = $(e).attr("name");
				var tihao = $("span[id=" + id + "]").html();
				values.push(tihao);
			});	
			var message="";
			for (var i = 0; i < values.length; i++) {
				arr2[values[i]-1]=1;
				/* message=message+""+values[i]+","; */
			}
	  if(values.length<10){
			for (var i = 0; i < arr2.length; i++) {
				if (arr2[i] == 1) {
					message=message+(i+1)+",";
				}
			}
			message=message+"已选择";
					
			for (var i = 0; i < arr2.length; i++) {
				if (arr2[i] == 0) {
					message=message+(i+1)+",";
				}
			}
			message+="未选择";
			
			alert(message);
		}
	 if(values.length==10){
	 
	     alert("没有未选择的选项");
	 }
	}
	
	
</script>

</head>


<body onload="countTime()">
	<div class="navbar">
		<div class="navbar-inner">
			<ul class="nav pull-right">
				<li><a href="#"
					class="hidden-phone visible-tablet visible-desktop" role="button">Settings</a></li>
				<li id="fat-menu" class="dropdown"><a href="#" role="button"
					class="dropdown-toggle" data-toggle="dropdown"> <i
						class="icon-user"></i> ${adminName} <i class="icon-caret-down"></i>
				</a>

					<ul class="dropdown-menu">
						<li><a tabindex="-1" href="#">My Account</a></li>
						<li class="divider"></li>
						<li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
						<li class="divider visible-phone"></li>
						<li><a tabindex="-1" href="sign-in.html">Logout</a></li>
					</ul></li>

			</ul>
			<a class="brand" href="index.html"><span class="first">在线考试</span>
				<span class="second">系统</span></a>

		</div>
	</div>

	<div class="sidebar-nav">
		 <a href="#dashboard-menu" class="nav-header" data-toggle="collapse"><i class="icon-dashboard"></i>用户管理<i class="icon-chevron-up"></i></a>
        <ul id="dashboard-menu" class="nav nav-list collapse in">
            <li><a href="listAllUser2">用户列表</a></li>
        </ul>

        <a href="#accounts-menu" class="nav-header" data-toggle="collapse"><i class="icon-briefcase"></i>题库管理<i class="icon-chevron-up"></i></a>
        <ul id="accounts-menu" class="nav nav-list collapse">
            <li ><a href="listAllTitle">题库详情</a></li>
        </ul>


		<a href="#error-menu" class="nav-header collapsed"
			data-toggle="collapse"><i class="icon-exclamation-sign"></i>试卷管理<i
			class="icon-chevron-up"></i></a>
		<ul id="error-menu" class="nav nav-list collapse">
			<li><a href="getAllTitleType">新增试卷</a></li>
			<li><a href="getPaperName">试卷列表</a></li>
		</ul>

		<a href="#legal-menu" class="nav-header" data-toggle="collapse"><i
			class="icon-legal"></i>人员管理</a>
		<ul id="legal-menu" class="nav nav-list collapse">
			<li><a href="page/admin/adminEdit.jsp">新增管理员 </a></li>
			<li><a href="adminList">管理员列表</a></li>
		</ul>
	</div>



	<div class="content">

		<div class="header">

			<h1 class="page-title">试卷</h1>
		</div>

		<ul class="breadcrumb">
			<li><a href="index.html">试卷管理</a> <span class="divider">/</span></li>
			<li class="active">试卷题目</li>
		</ul>
		<div class="container-fluid">
			<div class="row-fluid">

				<div class="btn-toolbar">
					<a href="getAllTitleType">
						<button class="btn btn-primary">
						<i class="icon-plus"></i> 新增试卷
						
					</button></a>
					<button class="btn" onclick="doCheck()">查看答题情况</button>
					
					<button class="btn">导出试卷${backuser.userId}</button>
					
					<div class="btn-group"></div>
				</div>
				<div class="well">
					<div class="daojishi">
						<div style="float:right;width:200px;height:50px;" id="timer">
							 <span style="color:black;">剩余时间:</span>
							 <span id="_m" style="color:#ff5800">00</span> <span id="_s" style="color:#ff5800">00</span>
						</div>
					</div>
					<div style="clear:both;">
					
					
						<form action="getErrorAndScore" method="post" id="theform1" name="theform1">
							<!-- <input type="hidden" name="uid" value=${backuser.userId}/> -->
							<table class="table">
								<thead>
								</thead>
								<tbody>
									<s:iterator value="paperAllList">
										<span id="<s:property value="tbQuestionbank.titleId"/>">
											<%
												List list = new ArrayList();
													out.println(++i);
											%>
										</span>

										<s:property value="tbQuestionbank.titleContent" />
										<br>

										<br>

										<input type="radio"
											name="<s:property value="tbQuestionbank.titleId"/>" value="A"
											class="inpputClass" />	
										A、<s:property value="tbQuestionbank.questionAnswerA" />
										<br>
										<input type="radio"
											name="<s:property value="tbQuestionbank.titleId" />"
											value="B" class="inpputClass" />		
									    B、<s:property value="tbQuestionbank.questionAnswerB" />
										<br>
										<input type="radio"
											name="<s:property value="tbQuestionbank.titleId" />"
											value="C" class="inpputClass" />	
										C、<s:property value="tbQuestionbank.questionAnswerC" />
										<br>
										<input type="radio"
											name="<s:property value="tbQuestionbank.titleId" />"
											value="D" class="inpputClass" />		
									    D、<s:property value="tbQuestionbank.questionAnswerD" />
									    
										<br>

										<span style="color:red">正确答案：<s:property
												value="tbQuestionbank.questionRightAnswer" /></span>
										<br>
										分值：<s:property value="tbQuestionbank.questionGrade" />
										试题类型：<s:property value="tbQuestionbank.questionType" />
										<br>
										试题详解：<s:property value="tbQuestionbank.questionDetail" />
										<br>
										<br>
										</tr>
									</s:iterator>
							<button class="btn btn-primary" type="submit" value="交卷" id="getPaper"  style="float:right;margin-right:300px;">
										<i class="icon-plus"></i> 交卷		
							</button>
					
									<!-- <a href="getScoreAction" <button class="btn btn-primary">
						             <i class="icon-plus"></i>交卷</button></a> -->
								</tbody>
								</form>
							</table>
					</div>
				</div>
				<%-- <div class="pagination">
					<ul>
						<!--  style="margin-left:350px;" -->
						<li><a href="getPaperList?currentPage=1"
							style="margin-left:550px;">首页</a></li>
						<li><a href="getPaperList?currentPage=${currentPage-1}">上一页</a></li>
						<li><a href="getPaperList?currentPage=${currentPage+1}">下一页</a></li>
						<li><a href="getPaperList?currentPage=${totalPage}">尾页</a></li>
					</ul>
					<div style="height:40px;line-height:40px; width:100px;float:right;">
						当前页:<span style="color:red">${currentPage}</span>/${totalPage}
					</div>

				</div> --%>

				<div class="modal small hide fade" id="myModal" tabindex="-1"
					role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">×</button>
						<h3 id="myModalLabel">Delete Confirmation</h3>
					</div>
					<div class="modal-body">
						<p class="error-text">
							<i class="icon-warning-sign modal-icon"></i>Are you sure you want
							to delete the user?
						</p>
					</div>
					<div class="modal-footer">
						<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
						<a href="deleteAdmin.action?id=<s:property value='adminId'/>"><button
								class="btn btn-danger">Delete</button></a>
					</div>
				</div>
				<footer>
				<hr>


				<p class="pull-right">
					Collect from <a href="http://www.cssmoban.com/" title="网页模板"
						target="_blank">网页模板</a>
				</p>

				<p>
					&copy; 2012 <a href="#" target="_blank">Portnine</a>
				</p>
				</footer>

			</div>
		</div>
	</div>



	<script src="lib/bootstrap/js/bootstrap.js"></script>
	<script type="text/javascript">
		$("[rel=tooltip]").tooltip();
		$(function() {
			$('.demo-cancel-click').click(function() {
				return false;
			});
		});
	</script>

</body>
</html>


